<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>2.1 浏览器兼容性</title>
    <style>
        header, footer {
            width: 100%;
            height: 50px;
        }
        header {
            background-color: red;

            /*display: -webkit-flex;
            display: -moz-flex;
            display: -ms-flex;
            display: -o-flex;
            display: flex;
            justify-content: center;
            -ms-align-items: center;
            align-items: center;*/
            /*text-align: center;
            line-height: 50px;*/
        }
        footer {
            background-color: green;
        }

        .flexbox header {
            display: -webkit-flex;
            display: -moz-flex;
            display: -ms-flex;
            display: -o-flex;
            display: flex;
            justify-content: center;
            -ms-align-items: center;
            align-items: center;
        }
        .no-flexbox header {
            text-align: center;
            line-height: 50px;
        }
    </style>
    <script src="js/html5shiv.min.js"></script>
    <script src="js/modernizr.js"></script>
</head>
<body>
    <header>header</header>
    <footer>footer</footer>

    <script>
        // if (requestAnimationFrame) { // 错误
        //     // ...
        // }
        // if (window.requestAnimationFrame) { // 正确

        // } else {

        // }

        var requestAnimationFrame = window.requestAnimationFrame ||
            window.webkitRequestAnimationFrame ||
            window.mozRequestAnimationFrame ||
            window.oRequestAnimationFrame ||
            window.msRequestAnimationFrame ||
            function (fn) {
                setTimeout(fn, 16);
            };

            requestAnimationFrame(function () {
                console.log(1);
            });
    </script>
</body>
</html>